package com.tfjybj.itoo.exam.provider.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dmsdbj.itoo.tool.redis.CacheExpire;
import com.tfjybj.itoo.exam.entity.EvaluationPaperDetailEntity;
import com.tfjybj.itoo.exam.model.EvaluationPaperDetailModel;
import com.tfjybj.itoo.exam.model.EvaluationRecordModel;
import org.apache.ibatis.annotations.Param;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * TeEvaluationPaperDetailDao接口
 * teEvaluationPaperDetail表
 *
 * @author 杨江涛
 * @version 2.0.0
 * @since 2.0.0 2018-12-18 18:19:48
 */
@Repository("teEvaluationPaperDetailDao")
public interface EvaluationPaperDetailDao extends BaseMapper<EvaluationPaperDetailEntity> {

    /**
     * 查询问卷试题详情-题干与各个选型对应关系
     * @param paperId 问卷id
     * @return 题干与各个选型对应关系
     * @author 杨晓慧
     * @since 2.0.0 2018-12-28 08:48:44
     */
    @Cacheable( value = "queryTeEvaluationPaperDetail",unless = "#result == null || #result.size()==0")
    @CacheExpire(expire = 120)
    List<EvaluationPaperDetailModel> queryTeEvaluationPaperDetail(@Param("paperId") String paperId);

    /**
     * 查询问卷下所有单选题和多选题题干
     * @param paperId 问卷id
     * @return 问卷下所有单选题和多选题题干
     * @author 杨晓慧
     * @since 2.0.0 2018-12-28 08:48:44
     */
    List<EvaluationPaperDetailModel> queryRadioAndCheckQuestion(@Param("paperId") String paperId);

    /**
     * 查询学生答题记录
     * @param paperId 问卷id
     * @param courseId 课程id
     * @param studentId 学生id
     * @param schoolYearId 学期学年
     * @return 学生答题记录
     * @author 杨晓慧
     * @since 2.0.0 2018-12-28 08:48:44
     */
    List<EvaluationRecordModel> queryStudentEvaluationRecord(@Param("paperId") String paperId, @Param("courseId") String courseId, @Param("studentId") String studentId, @Param("schoolYearId") String schoolYearId);

    /**
     * 根据问卷id查询问卷绑定关系表的信息
     * @param paperId 问卷id
     * @return 问卷绑定关系
     * @author 杨江涛
     * @since 2019-1-15 20:32:41
     */
    List<EvaluationPaperDetailModel> queryDetailInfo(@Param("paperId") String paperId);
}
